package truef.service.express.service;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import edu.zut.cs.software.base.service.GenericGenerator;
import truef.express.domain.Courier;
import truef.express.domain.ExpressCompany;
import truef.service.express.service.CourierManager;
import truef.service.express.service.ExpressCompanyManager;


public class CourierEntityGenerator  extends GenericGenerator{

	@Autowired
	CourierManager courierManager;
	
	@Autowired
	ExpressCompanyManager expressCompanyManager;
	
	@Test
    public void gen_expressCompany(ExpressCompany csc) {
        for (int i = 0; i < 2; i++) {
        	ExpressCompany c = new ExpressCompany();
            c.setName("ExpressCompany_" + i);
            this.expressCompanyManager.save(c);
            for (int j = 0; j < 2; j++) {
            	ExpressCompany expressCompany = new ExpressCompany();
            	expressCompany.setName("expressCompany_" + i + "_" + j);
            	expressCompany.setParent(c);
                c = this.expressCompanyManager.save(expressCompany);
                this.gen_expressCompany(c);
            }
        }
    }
	
	public void gen_courier(Courier c) {
		for (int i = 0; i < 2; i++) {
            Courier courier = new Courier();
            courier.setName("courierName_" + i);
            this.courierManager.save(courier);
        }
	}

}
